package com.eyaomall.wxmanage.common.error;

import javax.servlet.http.HttpServletResponse;


import com.lycheeframework.core.cmp.api.error.SECode;
import com.lycheeframework.core.common.util.JSONUtil;
import com.lycheeframework.core.exception.error.Error;
/**
 * 错误打印工具类
 * @author pro
 *
 */
public class ErrorOutPrint {
	/**
	 * 打印错误json
	 * @param response
	 */
	public static void renderErrorJson(HttpServletResponse response) {
		response.setContentType("application/json");  
		response.setCharacterEncoding("UTF-8");
		response.setHeader("Cache-Control", "no-cache");
		
		response.setStatus(200);
		
		java.io.PrintWriter print = null;
		try {
			Error error = new Error();
			error.setRet(SECode.s_100012.getCode());
			error.setMessage(SECode.s_100012.getMessage());
			
			print = response.getWriter();
			print.print(JSONUtil.toString(error));
		} catch (Exception e) {
			// ...
		} finally {
			print.close();
		}
	}
}